home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C/C++ Users Group Library 1996 July
/
C-C++ Users Group Library July 1996.iso
/
vol_200
/
219_01
/
a65.doc
< prev
next >
Wrap
Text File
|
1989-01-11
|
45KB
|
1,264 lines
/*
HEADER: CUG129;
TITLE: 6502/65C02 Cross-Assemblers;
FILENAME: A65.DOC;
VERSION: 0.1;
DATE: 08/27/1988;
DESCRIPTION: "These programs let you use your computer to assemble
code for the MOS Technology 6502 and Rockwell 65C02
microprocessors. The program is written in portable
C rather than BDS C. All assembler features are
supported except relocation, linkage, and macros.";
KEYWORDS: Software Development, Assemblers, Cross-Assemblers,
MOS Technology, Rockwell, 6502, 65C02;
SYSTEM: CP/M-80, CP/M-86, HP-UX, MSDOS, PCDOS, QNIX;
COMPILERS: Aztec C86, Aztec CII, Eco-C, HP-UX, Microsoft C,
QNIX C;
WARNINGS: "HP-UX is a Berkeley 4.2 UNIX look-alike, so the port
to UNIX should be trivial. So far, the program
compiles under two different MSDOS/PCDOS compilers, so
the port to other MSDOS/PCDOS compilers should be
easy.";
AUTHORS: William C. Colley III;
*/
6502/65C02 Cross-Assemblers
Version 0.1
Copyright (c) 1986 William C. Colley, III
The manual such as it is.
Legal Note: This package may be used for any commercial or
non-commercial purpose. It may be copied and
distributed freely provided that any fee charged
by the distributor of the copy does not exceed the
sum of: 1) the cost of the media the copy is
written on, 2) any required costs of shipping the
copy, and 3) a nominal handling fee. Any other
distribution requires the written permission of
the author. Also, the author's copyright notices
shall not be removed from the program source, the
program object, or the program documentation.
Table of Contents
1.0 How to Use the Cross-Assembler Package .................. 3
2.0 Format of Cross-Assembler Source Lines .................. 4
2.1 Labels ............................................. 5
2.2 Numeric Constants .................................. 5
2.3 String Constants ................................... 6
2.4 Expressions ........................................ 6
3.0 Machine Opcodes ......................................... 7
4.0 Pseudo Opcodes .......................................... 9
4.1 Pseudo-ops -- END .................................. 9
4.2 Pseudo-ops -- EQU .................................. 10
4.3 Pseudo-ops -- FCB .................................. 10
4.4 Pseudo-ops -- FCC .................................. 10
4.5 Pseudo-ops -- FDB .................................. 11
4.6 Pseudo-ops -- IF, ELSE, ENDI ....................... 11
4.7 Pseudo-ops -- INCL ................................. 12
4.8 Pseudo-ops -- ORG .................................. 12
4.9 Pseudo-ops -- PAGE ................................. 12
4.10 Pseudo-ops -- RMB .................................. 13
4.11 Pseudo-ops -- SET .................................. 13
4.12 Pseudo-ops -- TITL ................................. 13
5.0 Assembly Errors ......................................... 13
5.1 Error * -- Illegal or Missing Statement ............ 14
5.2 Error ( -- Parenthesis Imbalance ................... 14
5.3 Error " -- Missing Quotation Mark .................. 14
5.4 Error A -- Illegal Addressing Mode ................. 14
5.5 Error B -- Branch Target Too Distant ............... 14
5.6 Error D -- Illegal Digit ........................... 14
5.7 Error E -- Illegal Expression ...................... 15
5.8 Error I -- IF-ENDI Imbalance ....................... 15
5.9 Error L -- Illegal Label ........................... 15
5.10 Error M -- Multiply Defined Label .................. 15
5.11 Error O -- Illegal Opcode .......................... 15
5.12 Error P -- Phasing Error ........................... 16
5.13 Error R -- Illegal Register ........................ 16
5.14 Error S -- Illegal Syntax .......................... 16
5.15 Error T -- Too Many Arguments ...................... 16
5.16 Error U -- Undefined Label ......................... 16
5.17 Error V -- Illegal Value ........................... 16
6.0 Warning Messages ........................................ 17
6.1 Warning -- Illegal Option Ignored .................. 17
6.2 Warning -- -l Option Ignored -- No File Name ....... 17
6.3 Warning -- -o Option Ignored -- No File Name ....... 17
6.4 Warning -- Extra Source File Ignored ............... 17
6.5 Warning -- Extra Listing File Ignored .............. 17
6.6 Warning -- Extra Object File Ignored ............... 17
7.0 Fatal Error Messages .................................... 17
7.1 Fatal Error -- No Source File Specified ............ 17
7.2 Fatal Error -- Source File Did Not Open ............ 18
7.3 Fatal Error -- Listing File Did Not Open ........... 18
7.4 Fatal Error -- Object File Did Not Open ............ 18
7.5 Fatal Error -- Error Reading Source File ........... 18
7.6 Fatal Error -- Disk or Directory Full .............. 18
7.7 Fatal Error -- File Stack Overflow ................. 18
1
7.8 Fatal Error -- If Stack Overflow ................... 18
7.9 Fatal Error -- Too Many Symbols .................... 18
2
1.0 How to Use the Cross-Assembler Package
First, the question, "What does a cross-assembler do?" needs
to be addressed as there is considerable confusion on this point.
A cross-assembler is just like any other assembler except that it
runs on some CPU other than the one for which it assembles code.
For example, this package assembles 6502 or 65C02 source code
into 6502 or 65C02 object code, but it runs on an 8080, a Z-80,
an 8088, or whatever other CPU you happen to have a C compiler
for. The reason that cross-assemblers are useful is that you
probably already have a CPU with memory, disk drives, a text
editor, an operating system, and all sorts of hard-to-build or
expensive facilities on hand. A cross-assembler allows you to
use these facilites to develop code for a 6502 or 65C02.
This program requires one input file (your 6502 or 65C02 source
code) and zero to two output files (the listing and the object).
The input file MUST be specified, or the assembler will bomb on a
fatal error. The listing and object files are optional. If no
listing file is specified, no listing is generated, and if no
object file is specified, no object is generated. If the object
file is specified, the object is written to this file in "Intel
hexadecimal" format.
The command line for the 6502 cross-assembler looks like
this:
A65 source_file { -l list_file } { -o object_file }
where the { } indicates that the specified item is optional.